package com.feign.producer.controller;

import com.feign.core.domain.AjaxResult;
import com.feign.producer.model.ProducerInfo;
import com.feign.producer.service.IProducerService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/message")
public class ProducerController {

    @Resource
    private IProducerService producerService;


    @GetMapping(value = "/handle")
    public String getProducerMessage() {
        return producerService.getProducerMessage();
    }

    @PostMapping(value = "/commit")
    public String consumeMessagePost() {
        return producerService.consumeMessagePost();
    }

    @PostMapping("/updateProducer")
    public AjaxResult updateProducer(@RequestBody ProducerInfo producerInfo) {
        return producerService.updateProducer(producerInfo);
    }

    @GetMapping(value = "/getProducerAll")
    public AjaxResult getProducerAll() {
        return producerService.getProducerAll();
    }

    @PostMapping(value = "/deleteProducer")
    public AjaxResult deleteProducer(@RequestBody ProducerInfo producerInfo) {
        return producerService.deleteProducer(producerInfo);
    }
}
